package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.ApplicationManager;
import facilius.controller.action.curso.CursoCreateAction;
import facilius.controller.action.curso.CursoDeleteAction;
import facilius.controller.action.curso.CursoReadAction;
import facilius.controller.action.curso.CursoShowFormAction;
import facilius.controller.action.curso.CursoUpdateAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.Forward;
import org.mentawai.filter.AuthorizationFilter;

/**
 *
 * @author Graciano
 */
public class CursoActionManager implements ActionManager{

    public void loadActions(org.mentawai.core.ApplicationManager appManager) {
        ActionConfig ac = null;

        ac = new ActionConfig("CursoRead",CursoReadAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("jsp/curso/cursoList.page"));
        ac.addConsequence(ApplicationManager.EXCEPTION, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("curso")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("CursoShowForm",CursoShowFormAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("jsp/curso/cursoForm.page"));
        ac.addConsequence(ApplicationManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("curso")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("CursoCreate", CursoCreateAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("CursoRead.mtw"));
        ac.addConsequence(ApplicationManager.ERROR, new Forward("jsp/curso/cursoForm.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("curso")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("CursoDelete",CursoDeleteAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("CursoRead.mtw"));
        ac.addConsequence(ApplicationManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("curso")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("CursoUpdate",CursoUpdateAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("CursoRead.mtw"));
        ac.addConsequence(ApplicationManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("curso")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("CursoRead",CursoReadAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("jsp/curso/cursoList.page"));
        ac.addConsequence(ApplicationManager.EXCEPTION, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("curso")));
        appManager.addActionConfig(ac);
    }

}
